package main

import (
	"imooc/studygo/tree"
)

func main() {
	var root tree.TreeNode

	root = tree.TreeNode{Value: 3}
	root.Left = &tree.TreeNode{}
	root.Right = &tree.TreeNode{5, nil, nil}
	root.Right.Left = new(tree.TreeNode)
	root.Right.Right = tree.CreateNode(2)
	root.Right.Left.SetValue(4)

	root.Traverse()




	//var root tree.TreeNode
	//
	//
	////var root treeNode
	//
	//
	//root = tree.TreeNode{Value: 3}
	//
	//print(root)
	//root.Print()//接收者就是root使用print函数的参数node
	//fmt.Println()
	//root.Left = &tree.TreeNode{}
	//root.Right = &tree.TreeNode{4, nil, nil}
	//root.Right.left = new(tree.TreeNode)
	//fmt.Println(root.Right)
	//root.Right = tree.CreateNode(2)
	//nodes := []tree.TreeNode{
	//	tree.TreeNode{},
	//	{1, nil, nil},
	//	{5, nil, &root},
	//}
	//
	//
	//root.Right.left.setValue(4000)
	//root.right.left.print()
	//fmt.Println()
	//
	//fmt.Println(nodes)
	//
	//fmt.Println()
	//
	//root.print() //会拷贝root的值给print
	//root.setValue(523) //会将root的地址给setValue的值接收者，然后再将root的地址解析出来再进行操作
	//root.print()
	//
	//fmt.Println()
	//
	//pRoot := &root
	//pRoot.setValue(601)
	//pRoot.print()
	//root.print()
	//
	//var gRoot *treeNode
	//gRoot.setValue(100)
	//gRoot = &root
	//gRoot.setValue(200)
	//gRoot.print()
	//
	//fmt.Println()
	//
	//root.traverse()
	//
	//
	//fmt.Println()
	//myRoot := myTreeNode{&root}
	//myRoot.postOrder()
	//fmt.Println()
}
